package com.zlm.tools.controller;

import com.zlm.tools.advice.Log;
import com.zlm.tools.config.TimestampRequestBody;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author zlm
 * @date 2023/9/6
 */
@RestController
@RequestMapping("/api")
public class TestController {

    @Log
    @CrossOrigin
    @RequestMapping("/test")
    public String test(String str) {
        return str;
    }

    @PostMapping("/api")
    public Map<String,Object> api(@TimestampRequestBody Map<String,Object> json) {

        return json;
    }
    @RequestMapping("/time")
    public String time(String str) {

        if(StringUtils.hasText(str)){
            return str+System.currentTimeMillis();
        }
        return System.currentTimeMillis()+"";
    }
}
